package tripmaker

import util._

object Moneda {
  object NingunaMoneda extends Moneda
  
  object USD extends Moneda
  object UYU extends Moneda
  object CLP extends Moneda
  object ARS extends Moneda
  object BOB extends Moneda
  object PEN extends Moneda
}

import Moneda._

trait Moneda extends util.ObjectToString {
  private val tcMap = collection.mutable.Map.empty[Moneda, BigDecimal]
  
  def tc(vs: Moneda) = tcMap.getOrElseUpdate(vs, Inet.googleCurrency(1, id, vs.id))
  lazy val tcUSD = tc(USD)

  private val tcInvMap = collection.mutable.Map.empty[Moneda, BigDecimal]
  
  def tcInv(vs: Moneda) = tcInvMap.getOrElseUpdate(vs, Inet.googleCurrency(1, vs.id, id))
  lazy val tcUSDinv = tcInv(USD)
}